package com.igeek.javase.ch02;

/**
 * @author chenmin
 * 2023/7/11 16:19
 * @description Random案例
 */
public class RandomDemo {

    public static void main(String[] args) {
        /*
         * 需求：产生1~10 随机整数
         */
        //[0,1)随机小数
        double d = Math.random();
        System.out.println("d = "+d);

        //产生1~10随机整数  [1,10]
        int value=(int)(Math.random()*10+1);
        System.out.println("value = "+value);

        //Random [0,1)随机小数
        /*Random random = new Random;
        double v = random.nextDouble();
        System.out.println("v = "+v);*/
    }
}
